package cn.dzhang.spring.boot.model;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 *
 * @author dzhang
 * @since 2015年10月31日
 */
@Entity
@Table(name = "tbl_device_category")
public class DeviceCategory extends ModelBase {

	private static final long serialVersionUID = -7637888957351225456L;

	private String name;
	@OneToMany(cascade = CascadeType.ALL, mappedBy = "category")
	private final List<DeviceType> types = new ArrayList<>();

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public List<DeviceType> getTypes() {
		return types;
	}

	@Override
	public String toString() {
		return String.format("DeviceCategory [name=%s]", name);
	}

}
